package cn.iocoder.yudao.module.crossborder.order.dal.mysql.ordershipment;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.crossborder.order.dal.dataobject.ordershipment.OrderShipmentDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.crossborder.order.controller.admin.ordershipment.vo.*;

/**
 * 跨境电商订单发货 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface OrderShipmentMapper extends BaseMapperX<OrderShipmentDO> {

    default PageResult<OrderShipmentDO> selectPage(OrderShipmentPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OrderShipmentDO>()
                .eqIfPresent(OrderShipmentDO::getShipmentNo, reqVO.getShipmentNo())
                .eqIfPresent(OrderShipmentDO::getOrderId, reqVO.getOrderId())
                .eqIfPresent(OrderShipmentDO::getOrderNo, reqVO.getOrderNo())
                .eqIfPresent(OrderShipmentDO::getWarehouseId, reqVO.getWarehouseId())
                .likeIfPresent(OrderShipmentDO::getWarehouseName, reqVO.getWarehouseName())
                .eqIfPresent(OrderShipmentDO::getShipmentType, reqVO.getShipmentType())
                .eqIfPresent(OrderShipmentDO::getShippingMethod, reqVO.getShippingMethod())
                .eqIfPresent(OrderShipmentDO::getShippingService, reqVO.getShippingService())
                .eqIfPresent(OrderShipmentDO::getCarrierCode, reqVO.getCarrierCode())
                .likeIfPresent(OrderShipmentDO::getCarrierName, reqVO.getCarrierName())
                .eqIfPresent(OrderShipmentDO::getTrackingNo, reqVO.getTrackingNo())
                .eqIfPresent(OrderShipmentDO::getTrackingUrl, reqVO.getTrackingUrl())
                .eqIfPresent(OrderShipmentDO::getTotalQuantity, reqVO.getTotalQuantity())
                .eqIfPresent(OrderShipmentDO::getTotalWeight, reqVO.getTotalWeight())
                .eqIfPresent(OrderShipmentDO::getTotalVolume, reqVO.getTotalVolume())
                .eqIfPresent(OrderShipmentDO::getPackageCount, reqVO.getPackageCount())
                .eqIfPresent(OrderShipmentDO::getShippingCost, reqVO.getShippingCost())
                .eqIfPresent(OrderShipmentDO::getInsuranceCost, reqVO.getInsuranceCost())
                .eqIfPresent(OrderShipmentDO::getHandlingCost, reqVO.getHandlingCost())
                .eqIfPresent(OrderShipmentDO::getTotalCost, reqVO.getTotalCost())
                .eqIfPresent(OrderShipmentDO::getCurrencyCode, reqVO.getCurrencyCode())
                .betweenIfPresent(OrderShipmentDO::getEstimatedDeliveryDate, reqVO.getEstimatedDeliveryDate())
                .eqIfPresent(OrderShipmentDO::getEstimatedTransitDays, reqVO.getEstimatedTransitDays())
                .betweenIfPresent(OrderShipmentDO::getShipTime, reqVO.getShipTime())
                .betweenIfPresent(OrderShipmentDO::getPickupTime, reqVO.getPickupTime())
                .betweenIfPresent(OrderShipmentDO::getInTransitTime, reqVO.getInTransitTime())
                .betweenIfPresent(OrderShipmentDO::getOutForDeliveryTime, reqVO.getOutForDeliveryTime())
                .betweenIfPresent(OrderShipmentDO::getDeliveryTime, reqVO.getDeliveryTime())
                .eqIfPresent(OrderShipmentDO::getDeliveryAttempts, reqVO.getDeliveryAttempts())
                .eqIfPresent(OrderShipmentDO::getDeliveryStatus, reqVO.getDeliveryStatus())
                .eqIfPresent(OrderShipmentDO::getDeliverySignature, reqVO.getDeliverySignature())
                .eqIfPresent(OrderShipmentDO::getDeliveryNotes, reqVO.getDeliveryNotes())
                .eqIfPresent(OrderShipmentDO::getCustomsDeclaration, reqVO.getCustomsDeclaration())
                .eqIfPresent(OrderShipmentDO::getCustomsStatus, reqVO.getCustomsStatus())
                .eqIfPresent(OrderShipmentDO::getCustomsTrackingNo, reqVO.getCustomsTrackingNo())
                .eqIfPresent(OrderShipmentDO::getIsInsured, reqVO.getIsInsured())
                .eqIfPresent(OrderShipmentDO::getInsuranceAmount, reqVO.getInsuranceAmount())
                .eqIfPresent(OrderShipmentDO::getIsSignatureRequired, reqVO.getIsSignatureRequired())
                .eqIfPresent(OrderShipmentDO::getSpecialInstructions, reqVO.getSpecialInstructions())
                .eqIfPresent(OrderShipmentDO::getPackingSlipUrl, reqVO.getPackingSlipUrl())
                .eqIfPresent(OrderShipmentDO::getShippingLabelUrl, reqVO.getShippingLabelUrl())
                .eqIfPresent(OrderShipmentDO::getInvoiceUrl, reqVO.getInvoiceUrl())
                .eqIfPresent(OrderShipmentDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(OrderShipmentDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OrderShipmentDO::getId));
    }

}